﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms.DataVisualization.Charting;
using System.Drawing;
using MyHospital.BLL;
using System.Data.SqlClient;
using System.Data;

namespace MyHospital.web
{
    public partial class BookingCount : System.Web.UI.Page
    {
        BookingChart bookingChart = new BookingChart();
        Chart chart1 = new Chart();
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection mycon; SqlDataAdapter myda; DataSet myds;
            string con = "Server=(local);Database=MyHospital;Trusted_Connection=SSPI";
            string sql = "select Department.departName from Department " ;
           
            mycon = new SqlConnection(con);
            mycon.Open();
            myda = new SqlDataAdapter(sql, con);

            myds = new DataSet();
            myda.Fill(myds, "Department");
            mycon.Close();

            
            DataTable dt = new DataTable("Department");
            myda.Fill(dt);
            mycon.Close();
            chart1.DataSource = dt;

            for (int i = 0; i < dt.Columns.Count - 2; i++)
            {
                chart1.Series[i].XValueMember = dt.Columns[1].ColumnName;
              //  chart1.Series[i].YValueMembers = dt.Columns[i + 2].ColumnName;
               // chart1.Series[i].XValueType = ChartValueType.DateTime;
                chart1.Series[i].ChartType = SeriesChartType.StackedColumn; //设置图表类型             
            }
            string[] strXAxis = new string[4] { "0", "K01", "K02", "K03" };
            int[] iYAxis = new int[5] { 20, 40, 87, 29, 33};
            chart1.Series[0].Points.DataBindXY(strXAxis, iYAxis);
        }

    }
}